<template>
  <div id="app">
    <keep-alive include="zhibotongji">
      <router-view/>
   </keep-alive>

  </div>
</template>

<script>
export default {
  name: 'App',
  data() {
    return{
      includsname:[],
      shopid:''
    }
  },
  created(){
    var that = this
    if(JSON.parse(localStorage.getItem('SHOP'))){
      this.shopid = JSON.parse(localStorage.getItem('SHOP')).shop_id
      var namearr = []
      var getarr = JSON.parse(localStorage.getItem('LOCAL_NAV'+this.shopid))
      if(getarr && getarr.length > 0){
        for(var x = 0;x<getarr.length;x++){
          namearr.push(getarr[x].name1)
          if(getarr[x].name2!=''){
            namearr.push(getarr[x].name2)
          }
        }
        that.includsname = namearr
      }
    }
    // console.log('namearr——app')
    //     console.log(that.includsname)
  },
  mounted(){

      var that = this

      // 监听localhostStorage的数据变化，结合utils/tool.js配合使用
      window.addEventListener('setItemEvent', function(e) {
        var namearr = []
        if(e.key == 'LOCAL_NAV'+that.shopid){
          var getarr = JSON.parse(e.newValue)
          for(var x = 0;x<getarr.length;x++){
            namearr.push(getarr[x].name1)
            if(getarr[x].name2!=''){
              namearr.push(getarr[x].name2)
            }
          }
          that.includsname = namearr
          // console.log('namearr——app')
          // console.log(that.includsname)
        }



      })
    },
}
</script>

<style lang="scss">
  .el-popover{ min-width: 0;}
  .fuwenben p{ margin: 0; padding: 0; list-height: 40px;}
  .el-button.is-round{ padding: 11px 23px !important;}
  .el-button--small, .el-button--small.is-round{ padding: 8px 15px !important;}
  .w-e-button-container .right{ height: auto; width:80px;}



</style>
